package com.ruoyi.paipan.common;

import com.ruoyi.paipan.utils.LunarUtil;

public class LiuYue {
    private int index;
    private LiuNian liuNian;

    public LiuYue(LiuNian liuNian,int index) {
        this.index = index;
        this.liuNian = liuNian;
    }
    

    public int getIndex()
    {
        return this.index;
    }

    public LiuNian getLiuNian()
    {
        return this.liuNian;
    }

    public String getMonthInChinese()
    {
        return LunarUtil.MONTH.get(this.index + 1);
    }

    public String getGanZhi()
    {
        int offset = 0;
        String liuNianGanZhi = this.liuNian.getGanZhi();
        String yearGan = liuNianGanZhi.substring(0,liuNianGanZhi.length()/2+1);
        if ("甲".equals(yearGan) || "己".equals(yearGan)) {
            offset = 2;
        } else if ("乙".equals(yearGan) || "庚".equals(yearGan)) {
            offset = 4;
        } else if ("丙".equals(yearGan) || "辛".equals(yearGan)) {
            offset = 6;
        } else if ("丁".equals(yearGan) || "壬".equals(yearGan)) {
            offset = 8;
        }
        String gan = LunarUtil.GAN.get((this.index + offset) % 10 + 1);
        String zhi = LunarUtil.ZHI.get((this.index + LunarUtil.BASE_MONTH_ZHI_INDEX) % 12 + 1);
        return gan + zhi;
    }

    public String getXun()
    {
        return LunarUtil.getXun(this.getGanZhi());
    }

    public String getXunKong()
    {
        return LunarUtil.getXunKong(this.getGanZhi());
    }

    public static void main(String[] args) {
        System.out.println("1111111");
    }
}
